/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Clases;

import java.util.Hashtable;
import java.util.LinkedList;

/**
 *
 * @author CESAR
 */
public class ListaResponsable {
    
    private LinkedList <Responsable> listaRes;
    private Hashtable<Integer,Responsable> hashRes;
    private int ultimoId;
    public ListaResponsable() {
        listaRes= new LinkedList<Responsable>();
        hashRes=new Hashtable<Integer, Responsable>();
        
    }
    
    public void agregar(Responsable res)
    {
        listaRes.add(res);
        hashRes.put(res.getId(), res);
        ultimoId = res.getId();
    }
    
    public Responsable buscar(int e)
    {
        return hashRes.get(e);        
    }
      public LinkedList <Responsable> getListaResponsable()
    {
        return listaRes;           
    }
    public int getUltimoId()
    {
        return ultimoId;
    }
    public boolean borrar(Responsable res)
    {
        boolean b;
        b = listaRes.remove(res);
        if (!b)return b;
        Responsable r = hashRes.remove(res.getId());
        if(r == null ) return false;
        return b;
    }
    
    
   
    
}
